package tdrest;
import java.util.HashMap;
import java.util.Map;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;

import biblio.Biblio;

import com.sun.jersey.api.container.grizzly.GrizzlyWebContainerFactory;

@Path("hello") /*@ \label{l:hw:path} @*/
public class HelloWorldService {

	@POST
	@Produces("text/xml")
	@Consumes("text/xml")
	public Response helloword_POST (HelloWorldRequest request) {
		HelloWorldResponse r = new HelloWorldResponse();
		r.fullname = request.fullname;
		r.message = "Hello!";
		return Response.ok(r).build();
	}
	
	public static void main(String[] args) throws Exception {
		final String baseUri = "http://localhost:9998/";
		final Map<String, String> initParams = new HashMap<String, String>();

		initParams.put("com.sun.jersey.config.property.packages", "tdrest"); /*@ \label{l:hw:initp} @*/

		GrizzlyWebContainerFactory.create(baseUri, initParams); /*@ \label{l:hw:webc} @*/
	}
}
